package com.zheng.blog.controller;

import com.zheng.blog.pojo.Article;
import com.zheng.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 *  @author: zheng
 *  @Date: 2020-06-17 11:17
 *  @Description:
 */
@Controller
@RequestMapping("article")
public class ArticleController {
    @Autowired
    private ArticleService articleService;

    @RequestMapping("/selectArticle")
    public String selectArticleByPage(@RequestParam(defaultValue = "1") Integer current, Model model){
        Map map= articleService.selectArticleList(current);
        model.addAttribute("list",map.get("list"));
        model.addAttribute("total",map.get("total"));
        model.addAttribute("current",current);
        return "client/index";
    }
}
